Forums spaces tasks

Retrieving the forums from a space

Example of browsing the forums of a space.

public void forum_getForums( IForumModule module, IContext context, IForumSpace forumSpace ) throws Exception
{
        // retrieving all the forums of a forums space
        Collection forums = module.getForums( context, forumSpace );
        for ( Iterator iterator = forums.iterator() ; iterator.hasNext() ; )
        {
                IForum forum = (IForum)iterator.next();
                System.out.println( "Forum : " + forum.getLabel() );
        }
}

Retrieving a forum from a space

Example of recovering a forum.

public void forum_getForum( IForumModule module, IContext context, IForumSpace forumSpace ) throws Exception
{
        // retrieving a specific forum of a forums space
        IForum forum = module.getForum( context, forumSpace, "Les forums SDK" );
        System.out.println( "Forum : " + forum.getLabel() );
}

Creating a forum in a space

Example of creating a forum.

public void forum_createForum( IForumModule module, IContext context, IForumSpace forumSpace ) throws Exception
{
        // creating a forum in a forum space
        IForum forum = module.createForum( context, forumSpace, "Les forums SDK", "Discussion sur les forums SDK" );
        System.out.println( "Forum : " + forum.getLabel() );
}